package com.zjj.learn.designmodel.work.singleton;

/**
 * 懒汉式
 *
 * @author zjj_admin
 */
public final class Singleton2 {
    private Singleton2() {
    }

    private static volatile Singleton2 INSTANCE = null;

    public static Singleton2 getInstance() {
        if (INSTANCE != null) {
            return INSTANCE;
        }
        synchronized (Singleton2.class) {
            if (INSTANCE != null) {
                return INSTANCE;
            }
            INSTANCE = new Singleton2();
            return INSTANCE;
        }
    }
}